package com.jiaai.cloud.user.controller;

import com.jiaai.cloud.base.exception.ServiceException;
import com.jiaai.cloud.live.entity.TLiveSystemSetting;
import com.jiaai.cloud.user.entity.TUserWallet;
import com.jiaai.cloud.user.service.ITUserWalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 佳爱网络科技
 * @since 2017-08-01
 */
@RestController
@RequestMapping("/api/manage/tUserWallet")
public class TUserWalletController {
    @Autowired
    private ITUserWalletService itUserWalletService;

    //可以添加，有的话可以修改
    @RequestMapping( value ="/edit/{userId}/{moeny}" ,method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"})
    public  Object edit(@PathVariable("userId") String userId,@PathVariable("moeny") String moeny) throws ServiceException {
        try {
            itUserWalletService.updateUserId(userId,BigDecimal.valueOf(Long.valueOf(moeny)));
            return null;
        } catch (Exception e) {
            throw new ServiceException("更改失敗", e.getMessage());
        }
    }
}
